package cn.gemiman.daoyi.module.iot.job;

import cn.gemiman.daoyi.module.iot.service.jhlequipmentdevice.JhlEquipmentDeviceService;
import cn.gemiman.daoyi.module.iot.service.jhlequipmentplace.JhlEquipmentPlaceService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

@Component
public class JhlXxlJob {

    @Resource
    private JhlEquipmentPlaceService jhlEquipmentPlaceService;
    @Resource
    private JhlEquipmentDeviceService jhlEquipmentDeviceService;

    @XxlJob("asyncJhlEquipmentPlaceXxlJobHandler")
    public void asyncJhlEquipmentPlaceXxlJobHandler() {
        String params = XxlJobHelper.getJobParam();
        XxlJobHelper.log("asyncJhlEquipmentPlaceXxlJobHandler start, params: " + params);
        Integer i = jhlEquipmentPlaceService.asyncJhlEquipmentPlace();
        XxlJobHelper.log("asyncJhlEquipmentPlaceXxlJobHandler end, read: " + i);
    }

    @XxlJob("asyncJhlEquipmentDeviceXxlJobHandler")
    public void asyncJhlEquipmentDeviceXxlJobHandler() {
        String params = XxlJobHelper.getJobParam();
        XxlJobHelper.log("asyncJhlEquipmentDeviceXxlJobHandler start, params: " + params);
        Integer i = jhlEquipmentDeviceService.asyncJhlEquipmentDevice();
        XxlJobHelper.log("asyncJhlEquipmentDeviceXxlJobHandler end, read: " + i);
        Integer j = jhlEquipmentDeviceService.asyncDeleteJhlEquipmentDevice();
        XxlJobHelper.log("asyncDeleteJhlEquipmentDevice end, delete: " + j);
    }
}
